/*   1:    */package com.linkage.bss.commons.util;
/*   2:    */
/*   3:    */import java.io.Serializable;
/*   4:    */import java.util.ArrayList;
/*   5:    */import java.util.HashMap;
/*   6:    */import java.util.Map;
/*   7:    */
/*   8:    */public class JsonUtilTest
/*   9:    */{
/*  10:    */  public static Order mockOrder()
/*  11:    */  {
/*  12: 12 */    Order order = new Order();
/*  13: 13 */    order.setChannelCode("channe123");
/*  14: 14 */    order.setOrderContent("to install a new phone");
/*  15: 15 */    order.setOrderId(1L);
/*  16: 16 */    order.setOrderTypeId("09");
/*  17: 17 */    order.setStaffCode("staff001");
/*  18: 18 */    order.setAcceptDate(new java.util.Date());
/*  19: 19 */    Customer cust = new Customer();
/*  20: 20 */    cust.setAddress("中国台北市五一路");
/*  21: 21 */    cust.setId(1L);
/*  22: 22 */    cust.setName("赵鑫");
/*  23: 23 */    order.addCustomer(cust);
/*  24: 24 */    return order;
/*  25:    */  }
/*  26:    */  
/*  28:    */  public static void main(String[] args) {}
/*  29:    */  
/*  31:    */  private static void testOrder()
/*  32:    */  {
/*  33: 33 */    String orderJsonString = JsonUtil.getJsonString(mockOrder());
/*  34: 34 */    System.out.println("orderJsonString:" + orderJsonString);
/*  35:    */    
/*  36: 36 */    Map<String, Class> map = new HashMap();
/*  37: 37 */    map.put("customers", Customer.class);
/*  38: 38 */    Order order = (Order)JsonUtil.getObject(orderJsonString, Order.class, 
/*  39: 39 */      map);
/*  40: 40 */    System.out.println("order content:" + order.getOrderContent());
/*  41: 41 */    System.out.println("order content:" + order.getAcceptDate());
/*  42: 42 */    System.out.println("order.customer.address:" + 
/*  43: 43 */      ((Customer)order.getCustomers().get(0)).getAddress());
/*  44:    */  }
/*  45:    */  
/*  46:    */  public static class Customer implements Serializable
/*  47:    */  {
/*  48:    */    private static final long serialVersionUID = 1L;
/*  49:    */    private long id;
/*  50:    */    private String name;
/*  51:    */    private String address;
/*  52:    */    
/*  53:    */    public long getId() {
/*  54: 54 */      return this.id;
/*  55:    */    }
/*  56:    */    
/*  57:    */    public void setId(long id) {
/*  58: 58 */      this.id = id;
/*  59:    */    }
/*  60:    */    
/*  61:    */    public String getName() {
/*  62: 62 */      return this.name;
/*  63:    */    }
/*  64:    */    
/*  65:    */    public void setName(String name) {
/*  66: 66 */      this.name = name;
/*  67:    */    }
/*  68:    */    
/*  69:    */    public String getAddress() {
/*  70: 70 */      return this.address;
/*  71:    */    }
/*  72:    */    
/*  73:    */    public void setAddress(String address) {
/*  74: 74 */      this.address = address;
/*  75:    */    }
/*  76:    */  }
/*  77:    */  
/*  78:    */  public static class Order
/*  79:    */    implements Serializable
/*  80:    */  {
/*  81:    */    private static final long serialVersionUID = 1L;
/*  82:    */    private long orderId;
/*  83:    */    private String orderTypeId;
/*  84:    */    private String staffCode;
/*  85:    */    private String channelCode;
/*  86:    */    private String orderContent;
/*  87:    */    private java.util.Date acceptDate;
/*  88:    */    private java.util.List<JsonUtilTest.Customer> customers;
/*  89:    */    
/*  90:    */    public Order()
/*  91:    */    {
/*  92: 92 */      this.customers = new ArrayList();
/*  93:    */    }
/*  94:    */    
/*  95:    */    public void addCustomer(JsonUtilTest.Customer cust) {
/*  96: 96 */      if (this.customers == null)
/*  97: 97 */        this.customers = new ArrayList();
/*  98: 98 */      this.customers.add(cust);
/*  99:    */    }
/* 100:    */    
/* 101:    */    public java.util.List<JsonUtilTest.Customer> getCustomers() {
/* 102:102 */      return this.customers;
/* 103:    */    }
/* 104:    */    
/* 105:    */    public void setCustomers(java.util.List<JsonUtilTest.Customer> customers) {
/* 106:106 */      this.customers = customers;
/* 107:    */    }
/* 108:    */    
/* 109:    */    public long getOrderId() {
/* 110:110 */      return this.orderId;
/* 111:    */    }
/* 112:    */    
/* 113:    */    public java.util.Date getAcceptDate() {
/* 114:114 */      return this.acceptDate;
/* 115:    */    }
/* 116:    */    
/* 117:    */    public void setAcceptDate(java.util.Date acceptDate) {
/* 118:118 */      this.acceptDate = acceptDate;
/* 119:    */    }
/* 120:    */    
/* 121:    */    public void setOrderId(long orderId) {
/* 122:122 */      this.orderId = orderId;
/* 123:    */    }
/* 124:    */    
/* 125:    */    public String getOrderTypeId() {
/* 126:126 */      return this.orderTypeId;
/* 127:    */    }
/* 128:    */    
/* 129:    */    public void setOrderTypeId(String orderTypeId) {
/* 130:130 */      this.orderTypeId = orderTypeId;
/* 131:    */    }
/* 132:    */    
/* 133:    */    public String getStaffCode() {
/* 134:134 */      return this.staffCode;
/* 135:    */    }
/* 136:    */    
/* 137:    */    public void setStaffCode(String staffCode) {
/* 138:138 */      this.staffCode = staffCode;
/* 139:    */    }
/* 140:    */    
/* 141:    */    public String getChannelCode() {
/* 142:142 */      return this.channelCode;
/* 143:    */    }
/* 144:    */    
/* 145:    */    public void setChannelCode(String channelCode) {
/* 146:146 */      this.channelCode = channelCode;
/* 147:    */    }
/* 148:    */    
/* 149:    */    public String getOrderContent() {
/* 150:150 */      return this.orderContent;
/* 151:    */    }
/* 152:    */    
/* 153:    */    public void setOrderContent(String orderContent) {
/* 154:154 */      this.orderContent = orderContent;
/* 155:    */    }
/* 156:    */  }
/* 157:    */}


/* Location:           E:\workspace\sungl111\workspace_promotion\BizHallConfig\WebRoot\WEB-INF\lib\bss.commons-0.1.jar
 * Qualified Name:     com.linkage.bss.commons.util.JsonUtilTest
 * JD-Core Version:    0.7.0-SNAPSHOT-20130630
 */